<?php
class ShippingResponse extends Response{
	protected $myDom;
	function ShippingResponse($xml){
		$this->Response($xml);	
	}
	
	function getShippingOptions(){
		return $this->getAllByTagName('Option');
	}
	
	function getCheapestOption(){
		$shippingOptions = $this->getShippingOptions();
		$lowestPrice = -1;
		$lowestOption = null;
		foreach($shippingOptions as $shippingOption){
			if($lowestOption == null || $shippingOption['Price'] < $lowestPrice){
				$lowestPrice = $shippingOption['Price'];
				$lowestOption = $shippingOption; 	
			}
		}
		return $lowestOption;
	}
}
?>
